import request from '~/utils/resquest'

//  设备分类
export const getNodeByParentCode = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-system/deviceCategory/getNodeByParentCode',
    method: 'GET',
    params
  })
}

//  所属设施
export const selectBoxListByKey = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-assets/distribution/selectBoxListByKey',
    method: 'GET',
    params
  })
}
// 单灯型号
export const getModelList = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/getModelList',
    method: 'GET',
    params
  })
}

//  单灯-列表
export const deviceListGet = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/listPage',
    method: 'GET',
    params
  })
}

//  单灯-新增
export const deviceAdd = <T>(data: T) => {
  return request({ url: '/api/gxsaas-monitor/device/lamp/add', method: 'POST', data })
}

//  单灯-编辑
export const deviceUpdate = <T>(data: T) => {
  return request({ url: '/api/gxsaas-monitor/device/lamp/update', method: 'POST', data })
}

//  单灯-型号
export const getTenantModelList = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-system/deviceModel/getTenantModelList',
    method: 'GET',
    params
  })
}

//  单灯-删除
export const deviceRemove = <T>(params: T) => {
  return request({ url: '/api/gxsaas-monitor/device/lamp/remove', method: 'POST', params })
}
// 单灯简略信息
export const deviceSimpleMes = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/getLampNodeSimple',
    method: 'get',
    params
  })
}

//  单灯-详情
export const deviceView = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/view',
    method: 'GET',
    params
  })
}
// 单灯- 参数设置
export const saveParamSet = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/saveLampNodeParamSet',
    method: 'post',
    params
  })
}
// 单灯 - 下发参数
export const sendParamSet = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/ops/lampNodeParamsSet',
    method: 'post',
    params
  })
}
// 单灯 - 调光
export const singlelampDim = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/ops/lampNodeDim',
    method: 'post',
    params
  })
}
// 单灯 - 调光按位
export const singlelampDimLoop = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/ops/lampNodeDimLoop',
    method: 'post',
    params
  })
}
// 单灯 - 开关灯
export const singlelampSwitch = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/ops/lampNodeSwitch',
    method: 'post',
    params
  })
}
// // 设备管理-导出
// export const deviceExport = <T>(payload: T) =>
//   request({
//     url: '/api/gxsaas-monitor/device/export',
//     method: 'get',
//     responseType: 'blob',
//     ...payload
//   })

// 单灯分组 - 分页
export const groupList = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampGroup/listPage',
    method: 'GET',
    params
  })
}
// 单灯分组 - 新增
export const groupAdd = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampGroup/add',
    method: 'post',
    data: params
  })
}
// 单灯分组 - 编辑
export const groupUpdate = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampGroup/update',
    method: 'post',
    data: params
  })
}
// 单灯分组 - 删除
export const groupDelete = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampGroup/remove',
    method: 'post',
    params
  })
}
// 单灯分组-列表
export const groupData = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampGroup/list',
    method: 'get',
    params
  })
}
// 灯杆列表 - 分页
export const lamppostList = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampPost/listPage',
    method: 'GET',
    params
  })
}
// 灯杆列表 - 新增
export const lamppostAdd = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampPost/add',
    method: 'post',
    data: params
  })
}
// 灯杆列表 - 编辑
export const lamppostUpdate = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampPost/update',
    method: 'post',
    data: params
  })
}
// 灯杆列表 - 删除
export const lamppostDelete = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampPost/remove',
    method: 'post',
    params
  })
}
// 灯杆列表 - 同步资产
export const syncLamppost = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampPost/syncAssetLampPostInfo',
    method: 'post',
    params
  })
}
// 灯杆列表-批量修改灯杆分组
export const changeGroup = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampPost/updateGroup',
    method: 'post',
    params
  })
}
// 关键字搜索单灯
export const getsingleLampBykeyword = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampPost/getLampNodeByKey',
    method: 'get',
    params
  })
}
// 获取灯杆关联单灯
export const getSingleLampAndpost = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampPost/postLampList',
    method: 'post',
    params
  })
}
// 绑定单灯
export const lamppostBindLamp = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampPost/bindLamp',
    method: 'post',
    data: params
  })
}
// 单灯策略 - 分页
export const taskList = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampTask/listPage',
    method: 'GET',
    params
  })
}
// 单灯策略 - 新增
export const taskAdd = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampTask/add',
    method: 'post',
    data: params
  })
}
// 单灯策略 - 编辑
export const taskUpdate = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampTask/update',
    method: 'post',
    data: params
  })
}
// 单灯策略 - 删除
export const taskDelete = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampTask/remove',
    method: 'post',
    params
  })
}
// 单灯策略 - 详情
export const taskDetail = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampTask/view',
    method: 'get',
    params
  })
}
// 单灯策略 - 召测计划
export const callLampPlan = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampTask/callTaskInfo',
    method: 'post',
    params
  })
}
// 任务设备明细
export const getTaskDeviceListPage = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampTask/getTaskDeviceListPage',
    method: 'post',
    params
  })
}
// 下发策略
export const sendTask = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampTask/executeTask',
    method: 'post',
    params
  })
}
// 单灯警报设置 - 分页
export const lampAlarmPage = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampAlarmConfig/listPage',
    method: 'get',
    params
  })
}
// 单灯警报设置 - 修改
export const lampAlarmUpdate = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampAlarmConfig/update',
    method: 'post',
    data: params
  })
}
// 运行地图 - 查询灯杆树
export const getPostTree = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/runMap/getPostTree',
    method: 'get',
    params
  })
}
// 运行地图 - 查询灯杆点位数据
export const getPostPositionData = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/runMap/getLampPostPointList',
    method: 'get',
    params
  })
}
// 运行地图 - 查询灯杆详情
export const getPostDetail = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/runMap/getLampPostInfo',
    method: 'get',
    params
  })
}
// 运行地图 - 灯杆召测
export const lamppostPoll = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/runMap/lampPost/dataPollGet',
    method: 'post',
    params
  })
}
// 运行地图 - 灯杆开关灯
export const lamppostSwitch = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/runMap/lampPost/switch',
    method: 'post',
    params
  })
}
// 运行地图 - 灯杆调光
export const lamppostdim = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/runMap/lampPost/dim',
    method: 'post',
    params
  })
}
// 运行地图 - 灯杆更换分组
export const updateGroup = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/runMap/updateGroup',
    method: 'post',
    params
  })
}
// 运行地图 - 分组批量开关灯
export const groupSwitchLight = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/runMap/group/switch',
    method: 'post',
    params
  })
}
// 运行地图 - 分组批量调光
export const groupDim = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/runMap/group/dim',
    method: 'post',
    params
  })
}
// 运行地图 - 查询灯杆当日实时统计数据
export const dayEnergyData = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampReport/getLampPostDayEnergyData',
    method: 'get',
    params
  })
}
// 运行地图 - 查询当日灯杆24小时调光曲线图
export const dayDimData = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampReport/getLampPostDay24DimData',
    method: 'get',
    params
  })
}
// 运行地图 - 查询当日灯杆24小时能耗曲线图
export const energyData = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampReport/getLampPostDay24EnergyData',
    method: 'get',
    params
  })
}
// 运行地图 - 单灯召测工况
export const callLampWorkData = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/ops/lampNodeDataPollGet',
    method: 'post',
    params
  })
}
// 运行地图 - 单灯召测时钟
export const callLampTime = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/ops/lampNodeTimeSyncGet',
    method: 'post',
    params
  })
}
// 运行地图 - 单灯解除漏电保护
export const lampNodeCleanProtect = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/ops/lampNodeCleanProtect',
    method: 'post',
    params
  })
}
// 运行地图 - 单灯复位
export const lampResetting = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/ops/lampNodeReset',
    method: 'post',
    params
  })
}
// 运行地图 - 单灯设备校时
export const lampNodeTimeSyncSet = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lamp/ops/lampNodeTimeSyncSet',
    method: 'post',
    params
  })
}
// 单灯工况 - 分页
export const getWorkData = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-monitor/device/lampWorkinfo/listPage',
    method: 'get',
    params
  })
}
// 单灯工况 - 导出
export const exportWorkData = <T>(payload: T) =>
  request({
    url: '/api/gxsaas-monitor/device/lampWorkinfo/export',
    method: 'get',
    responseType: 'blob',
    ...payload
  })

// 单灯警报列表 - 分页
export const alarmlistPage = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/device/lampAlarm/listPage',
    method: 'get',
    params
  })

// 单灯设备-导入
export const importLampExcel = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/device/lamp/import-excel-new',
    method: 'post',
    data: params
  })

// 单灯灯杆-导入
export const importLampPostExcel = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/device/lampPost/import-excel-new',
    method: 'post',
    data: params
  })

// 下载单灯灯杆模版
export const exportLampPost = <T>(payload: T) =>
  request({
    url: '/api/gxsaas-monitor/device/lampPost/export-template',
    method: 'get',
    responseType: 'blob',
    ...payload
  })

// 下载单灯设备模版
export const exportLamp = <T>(payload: T) =>
  request({
    url: '/api/gxsaas-monitor/device/lamp/export-template',
    method: 'get',
    responseType: 'blob',
    ...payload
  })
